package cn.iocoder.yudao.module.mqtt.dal.mysql.devicealermrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.dal.dataobject.devicealermrecord.DeviceAlermRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mqtt.controller.admin.devicealermrecord.vo.*;

/**
 * 报警记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DeviceAlermRecordMapper extends BaseMapperX<DeviceAlermRecordDO> {

    default PageResult<DeviceAlermRecordDO> selectPage(DeviceAlermRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceAlermRecordDO>()
                .eqIfPresent(DeviceAlermRecordDO::getSubscribeWaterId, reqVO.getSubscribeWaterId())
                .eqIfPresent(DeviceAlermRecordDO::getDeviceKey, reqVO.getDeviceKey())
                .eqIfPresent(DeviceAlermRecordDO::getAlarmType, reqVO.getAlarmType())
                .eqIfPresent(DeviceAlermRecordDO::getDataType, reqVO.getDataType())
                .eqIfPresent(DeviceAlermRecordDO::getExceedValue, reqVO.getExceedValue())
                .eqIfPresent(DeviceAlermRecordDO::getAlarmInfo, reqVO.getAlarmInfo())
                .eqIfPresent(DeviceAlermRecordDO::getIsWeixin, reqVO.getIsWeixin())
                .eqIfPresent(DeviceAlermRecordDO::getIsQms, reqVO.getIsQms())
                .eqIfPresent(DeviceAlermRecordDO::getIsOnline, reqVO.getIsOnline())
                .eqIfPresent(DeviceAlermRecordDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(DeviceAlermRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceAlermRecordDO::getId));
    }

}